﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RushTracker.Core.Util
{
    public class CacheHelper<T> where T : class
    {
        public static T GetObject(string key)
        {
            object val = System.Web.HttpContext.Current.Cache[key];
            if (val == null)
                return null;
            else
                return val as T;
        }

        public static void InsertObject(string key, T val, DateTime expiration)
        {
            System.Web.HttpContext.Current.Cache.Insert(key, val, null, expiration, System.Web.Caching.Cache.NoSlidingExpiration);
        }
    }
}
